#ifndef PCIE_X1075_H
#define PCIE_X1075_H

#include <iostream>
#include <fstream>
#include <queue>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <iomanip>
#include <sstream>
#include <filesystem>
#include <tuple>

#include "CxDeviceSDK.h"

extern int cardCount;                // 扫描到可操作的板卡数量
extern CardInfo* cardInfoList;       // 板卡信息
extern PXIeCard_DeviceHandle handle; // 板卡句柄

// Pcie_X1075 类定义
class Pcie_X1075
{
private:
	//uint32_t fileEntryCount[5];    // 当前文件已写入的次数
	// 创建新文件的函数
	void printVoltageList(double* voltageList, int dataLength);

public:
	Pcie_X1075();
	~Pcie_X1075();

	static int packeventCount[4];

	int CxDevice_Init(CardInfo* _CardInfo, int32_t* cardCount, CxDeviceHandle* hDevice);
	void Channel_Init(CxDeviceHandle* hDevice, uint8_t CH_Quantity);
	int ChannelConfiguration(CxDeviceHandle* hDevice,
		int32_t chNo,
		int32_t _TrigSource,
		int32_t _TrigMode,
		int32_t _ExternalTrigPolarity,
		int32_t _TrigPolarity,
		int32_t _TrigPosition,
		int32_t _TrigLength,
		int32_t _TrigLevel,
		int32_t _TrigWindowStart,
		int32_t _TrigWindowEnd,
		int32_t _TrigPulseWidth,
		int32_t _VoltageRange,
		int32_t _TrigBaselineMode,
		int32_t _VoltageOffset,
		int32_t _InputImpedance,
		int32_t _CouplingMode);
	int ChannelReadEnabler(CxDeviceHandle* hDevice, int32_t chNo);
	int ChannelReadStop(CxDeviceHandle* hDevice, int32_t chNo);

	int ChannelSoftwareTrigger(CxDeviceHandle* hDevice, int32_t chNo);

	static void packevent(SciAcqPackage* package);


};

extern Pcie_X1075 pcie_X1075;

#endif // PCIE_X1075_H
